#!/usr/bin/env python
# -*- coding: UTF-8 -*-
'''=================================================
@Project -> File   ：FastRiteApi -> outbound_order
@IDE    ：PyCharm
@Author ：Json
@Date   ：2025/3/20 14:27
@Desc   ：
=================================================='''
from xlwms_api.base.client import Client
from xlwms_api.base.helpers import sp_endpoint
from xlwms_api.utils.load_all_pages import fetch_all_pages_with_delay


class Inventory(Client):

    @sp_endpoint(f'/integratedInventory/pageOpen')
    def page_open(self, **kwargs):
        """
        综合库存查询
        """
        return self._request(kwargs.pop('path'), data={**kwargs})

    @sp_endpoint('/cali/search')
    def cali_search(self, **kwargs):
        """
        盘点单查询
        :param kwargs:
        :return:
        """
        return self._request(kwargs.pop('path'), data={**kwargs})

    @sp_endpoint('/integratedInventory/pageStockAge')
    def page_stock_age(self, **kwargs):
        """
        分页查询库龄
        :param kwargs:
        :return:
        """
        return self._request(kwargs.pop('path'), data={**kwargs})

    @sp_endpoint('/outboundOrder/selectBizStatus')
    def select_biz_status(self, **kwargs):
        """
        取消出库订单
        :param kwargs:
        :return:
        """
        return self._request(kwargs.pop('path'), data={**kwargs})

    @fetch_all_pages_with_delay(delay=1.5)
    def all_page(self, **kwargs):
        return self.page_open(**kwargs)